import request from '@/utils/request'

// 获取识别记录列表
export function getRecordList(query) {
  return request({
    url: '/customer/recRecord/list',
    method: 'get',
    params: query
  })
}

// 获取识别记录详细信息
export function getRecRecord(recordId) {
  return request({
    url: '/customer/recRecord/' + recordId,
    method: 'get'
  })
}

// 新增识别记录
export function addRecRecord(data) {
  return request({
    url: '/customer/recRecord',
    method: 'post',
    data: data
  })
}

// 修改识别记录
export function updateRecRecord(data) {
  return request({
    url: '/customer/recRecord',
    method: 'put',
    data: data
  })
}

// 删除识别记录
export function deleteRecRecord(recordId) {
  return request({
    url: '/customer/recRecord/' + recordId,
    method: 'delete'
  })
}

// 批量删除识别记录
export function deleteRecRecords(recordIds) {
  return request({
    url: '/customer/recRecord/' + recordIds,
    method: 'delete'
  })
}

// 导出识别记录
export function exportRecRecord(query) {
  return request({
    url: '/customer/recRecord/export',
    method: 'post',
    data: query,
    responseType: 'blob'
  })
}

// 获取识别统计信息
export function getRecordStats(query) {
  return request({
    url: '/customer/recRecord/stats',
    method: 'get',
    params: query
  })
}

// 获取预警记录
export function getDangerRecords(query) {
  return request({
    url: '/customer/recRecord/danger',
    method: 'get',
    params: query
  })
}

// 标记记录为已处理
export function markRecordProcessed(recordId) {
  return request({
    url: '/customer/recRecord/process/' + recordId,
    method: 'put'
  })
}

// 批量标记记录为已处理
export function markRecordsProcessed(recordIds) {
  return request({
    url: '/customer/recRecord/process/batch',
    method: 'put',
    data: { recordIds }
  })
}

// 重新识别
export function reRecognize(recordId) {
  return request({
    url: '/customer/recRecord/reRecognize/' + recordId,
    method: 'post'
  })
}

// 获取识别记录的图片
export function getRecordImage(recordId, imageType) {
  return request({
    url: '/customer/recRecord/image/' + recordId,
    method: 'get',
    params: { type: imageType }, // 'input' 或 'output'
    responseType: 'blob'
  })
}

// 下载识别结果
export function downloadRecordResult(recordId) {
  return request({
    url: '/customer/recRecord/download/' + recordId,
    method: 'get',
    responseType: 'blob'
  })
}